package com.demo.web_06;

import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;

@WebServlet("/origin2")
public class OriginServlet2 extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest request,
                         HttpServletResponse response)throws ServletException, IOException {
        PrintWriter out = response.getWriter();
        out.println("OriginServlet2");
        // 输出 HTML 内容

        RequestDispatcher dispatcher = request.getRequestDispatcher("new");
        // 请求转发
        dispatcher.forward(request, response);
        out.println("OriginServlet2");
    }
}